package com.jinsi.service.tang.iml;

import com.jinsi.constant.TangConstant;
import com.jinsi.mapper.tang.JournalMapper;
import com.jinsi.pojo.Journal;
import com.jinsi.service.tang.JournalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;

/**
 * 查看商品日志列表
 * @author 唐文博
 * @Date 2022-08-09
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class JournalServiceImpl implements JournalService {
    @Autowired
    private JournalMapper journalMapper;

    /**
     * 查看表，全查 模糊查
     * @param journalName
     * @param journalOperationList
     * @param journalOperation
     * @param timeTable
     * @return
     */
    @Override
    @Transactional(readOnly = true)
    public List<Journal> getJournalSee(String journalName, String journalOperationList, String journalOperation,
                                      String timeTable) {
        return journalMapper.getJournalSee(journalName,journalOperationList,
                journalOperation,timeTable,TangConstant.COMMODITY_ISDEL);
    }

    /**
     * 假删除 商品删除
     * @param journalId
     */
    @Override
    public void deleteJournal(Integer journalId) {
        journalMapper.deleteJournal(journalId,TangConstant.COMMODITY_ISDELETE);
    }

    /**
     * 点击按钮添加查看日志 添加日志
     * @param journalName
     * @param journalOperationList
     * @param timeTable
     * @param journalOperation
     * @param journalRemarks
     * @param journalIsdel
     * @throws Exception
     */
    @Override
    public void addCkJournal(String journalName, String journalOperationList, Date timeTable,
                             String journalOperation, String journalRemarks, Integer journalIsdel) throws Exception {
        journalMapper.addCkJournal(journalName,journalOperationList,timeTable,
                journalOperation,journalRemarks,journalIsdel);
    }


}
